import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'

var state = {
    count: 0
}

var mutations = {
    increment: function (state) {
        state.count++
    }
}

var actions = {
    increment: function (o) {
        o.commit('increment')
    }
}

var getters = {
    evenOrOdd: function (state) {
        return state.count % 2 === 0 ? 'even' : 'odd'
    }
}

var store = new Vuex.Store({
    state: state,
    getters: getters,
    actions: actions,
    mutations: mutations,
    plugins: [createLogger()]
})

export default store;